home *** CD-ROM | disk | FTP | other *** search
/ Windows News 2010 Summer - Disc 1 / WN_Ete2010_CD1.iso / Onglet5 / Weezo / Weezo setup.exe / {code_appDir} / www / res / administration / std / mobileGeneral.php < prev    next >
PHP Script  |  2010-05-19  |  7KB  |  162 lines

  1. <?php
  2. /**
  3.  * General options configuration for mobiles
  4.  *
  5.  * this script is included by index.php and shouldn't be directly called
  6.  *
  7.  * PHP version 5
  8.  *
  9.  * LICENSE: This source file is subject to version 3.0 of the PHP license
  10.  * that is available through the world-wide-web at the following URI:
  11.  * http://www.php.net/license/3_0.txt.  If you did not receive a copy of
  12.  * the PHP License and are unable to obtain it through the web, please
  13.  * send a note to license@php.net so we can mail you a copy immediately.
  14.  *
  15.  * @category   NA
  16.  * @package    NA
  17.  * @author     Nicolas Bruley / Peer 2 World <contact@weezo.net>
  18.  * @copyright  2005-2009 Nicolas Bruley / Peer 2 World
  19.  * @license    http://www.php.net/license/3_0.txt  PHP License 3.0
  20.  * @version    CVS: $Id:$
  21.  * @link       http://www.weezo.net
  22.  * @since      File available since Release 1.4.0
  23.  */
  24. require(INCLUDE_DIR.'mobileFunctions.php');
  25. require_once(INCLUDE_DIR.'resourceConfigFunctions.php');
  26.  
  27. // Set this value to true to indicate not to display HTML page and JS Stuff (used when dumping a log to output)
  28. $displayFinished=false;
  29.  
  30.  
  31. /*
  32.  * Verify access rights
  33. */
  34. if($_SERVER['REMOTE_ADDR']!='127.0.0.1'){
  35.     if(cfUGetVar('administrator')!=true || !cfGGetVar('remoteAdministrationAuthorized')) outDisplayErrorPage(cfcaption('errorRemoteAdministrationNotAuthorized'));
  36. }
  37.  
  38. /*
  39.  ***************************************************************************************************************************
  40.  * Insert HEAD, FORMS and JAVASCRIPT functions
  41.  ***************************************************************************************************************************
  42.  */
  43. mfInsertHead();
  44.  
  45. require(dirname($_SERVER['SCRIPT_FILENAME']).'/general.php');
  46.  
  47.  
  48. if($displayFinished) exit;
  49.  
  50. /*
  51.  ***************************************************************************************************************************
  52.  * Display general tab
  53.  ***************************************************************************************************************************
  54.  */
  55.  
  56.  
  57.  
  58.  
  59. // Misc advanced admin actions
  60. if(cfRGetVar('advancedAdministration')){
  61.     echo outDivFrame('frame2');
  62.  
  63.     echo mfListTable();
  64.  
  65.     // Remote desktop
  66.     echo mfListSpacer(cfCaption('remoteDesktop'));
  67.     echo mfListItem('onclick="document.location=\''.$_SERVER['PHP_SELF'].'?panel=remoteDesktop\'"',outImage(outIcon('desktop32'),false,'class="frLi2"'),false,cfCaption('remoteDesktop'));
  68.  
  69.     // Dos prompt
  70.     echo mfListSpacer(cfCaption('dosPrompt'));
  71.     echo mfListItem('onclick="document.location=\''.$_SERVER['PHP_SELF'].'?panel=prompt\'"',outImage(outIcon('prompt32'),false,'class="frLi2"'),false,cfCaption('dosPrompt'));
  72.  
  73.     // Server Restart / Shutdown
  74.     echo mfListSpacer(cfCaption('mainServer'));
  75.     echo mfListItem('onclick="restartServer()"',outImage('serverRestart.png',false,'class="frLi2"'),false,cfCaption('adminRestart'));
  76.     echo mfListItem('onclick="stopServer()"',outImage('serverShutdown.png',false,'class="frLi2"'),false,cfCaption('adminComputerShutdown'));
  77.  
  78.     // Computer turn off / restart
  79.     echo mfListSpacer(cfCaption('adminComputer'));
  80.     echo mfListItem('onclick="restartComputer()"',outImage('computerRestart.png',false,'class="frLi2"'),false,cfCaption('adminRestart'));
  81.     echo mfListItem('onclick="stopComputer()"',outImage('computerShutdown.png',false,'class="frLi2"'),false,cfCaption('adminComputerShutdown'));
  82.  
  83.     // Weezo reboot
  84.     echo mfListSpacer('Weezo');
  85.     echo mfListItem('onclick="restartWeezo()"',outImage(outIcon('appIcon32'),false,'class="frLi2"'),false,cfCaption('adminRestart'));
  86.  
  87.  
  88.     echo '</table>';
  89. }
  90.  
  91.  
  92. // Connected users
  93. $nb=0;
  94. $sessions=glob(cfAppDataDir().'/sessiondata/sess_*');
  95. $out='';
  96. foreach ($sessions as $completeFilename){
  97.     $file=basename($completeFilename);
  98.  
  99.     if($isCurrentUser=($file=='sess_'.wSession_id())){
  100.             $out.=mfListItem('',outImage('/gfx/icons/'.cfUGetVar('icon'),false,'class="frLi2"'),false,'<div class="lit">'.cfUTF8Encode(cfUGetVar('name')).'</div>'.cfCaption('activityConnectedSince').' '.cfUTF8Encode(@date(cfCaption('_FULL_DATE_FORMAT'),$_SESSION['connectionTime'])));
  101.             $nb++;
  102.     }
  103.     else{
  104.         $sess=cfUnserializeSession(file_get_contents($completeFilename));
  105.  
  106.         if(isset($sess['user']['name']) && isset($sess['accountIP']) && isset($sess['connectionTime'])){
  107.             $out.=mfListItem('onclick="javascript:disconnect(\''.$file.'\')"',outImage(outIcon('logout'),false,'class="frLi2"'),false,'<div class="lit">'.cfUTF8Encode($sess['user']['name']).'</div>'.cfCaption('activityConnectedSince').' '.cfUTF8Encode(@date(cfCaption('_FULL_DATE_FORMAT'),$sess['connectionTime'])));
  108.             $nb++;
  109.         }
  110.         unset($sess);
  111.     }
  112. }
  113. // Display connected users (only if any)
  114. if($nb){
  115.     echo outDivFrame('frame2');
  116.     echo mfListTable();
  117.     echo mfListSpacer(cfCaption('adminConnectedUsers').cfCaption('genSeparator').cfCaption('mainNumberConnectedUsers',$nb));
  118.     echo $out.'</table>';
  119.     echo '</div>';
  120. }
  121.  
  122.  
  123.  
  124.  
  125.  
  126. echo outDivFrame('frame1');
  127. //echo '<div class="frame1Header">'.outThemeImage(outicon('config'),false,false,'margin-right:1em').cfCaption('adminGeneral').'</div>';
  128.  
  129.  
  130. // Bittorrent seeder
  131. echo outDivFrame('frame2');
  132. echo mfListTable();
  133. echo mfListSpacer(cfCaption('bittorrent'));
  134. // If enabled, ping seeder to verify it's actually responding
  135. if(cfGGetVar('bittorrentEnabled')) {
  136.     echo mfListItem(false,outImage(outIcon('isOn'),false,'class="frLi16"'),false,'<div class="lit">'.cfCaption('bittorrent').'</div>'.cfCaption('genActivated'),false,false,false);
  137.     // Ping seeder
  138.     if($sock=@fsockopen('127.0.0.1',cfGGetVar('bittorrentPort'),$errno,$errstr,3)){
  139.         fclose($sock);
  140.         echo mfListItem(false,outImage(outIcon('isOn'),false,'class="frLi16"'),false,'<div class="lit">Seeder</div>'.cfCaption('genActivated'),false,false,false);
  141.     }
  142.     else {
  143.         echo mfListItem(false,outImage(outIcon('isOff'),false,'class="frLi16"'),false,'<div class="lit">Seeder</div>'.cfCaption('genActivatedFalse'),false,false,false);
  144.     }
  145. }
  146. else {
  147.     echo mfListItem(false,outImage(outIcon('isOff'),false,'class="frLi16"'),false,'<div class="lit">'.cfCaption('bittorrent').'</div>'.cfCaption('genActivatedFalse'),false,false,false);
  148.     echo mfListItem(false,outImage(outIcon('isOff'),false,'class="frLi16"'),false,'<div class="lit">Seeder</div>'.cfCaption('genActivatedFalse'),false,false,false);
  149. }
  150. echo "</table></div>\n";
  151.  
  152.  
  153. // Logs
  154. echo mfListTable();
  155. echo mfListSpacer(cfCaption('activityLogs'));
  156. echo mfListItem('onclick="logApacheAccess()"',outImage(outIcon('apache'),false,'class="frLi2"'),false,cfCaption('logApache'),false,outImage(outIcon('go')));
  157. echo mfListItem('onclick="logApacheError()"',outImage(outIcon('bugs'),false,'class="frLi2"'),false,cfCaption('logApacheError'),false,outImage(outIcon('go')));
  158. echo mfListItem('onclick="logApplication()"',outImage(outIcon('appIcon32'),false,'class="frLi2"'),false,cfCaption('logApplication'),false,outImage(outIcon('go')));
  159. echo '</table>';
  160. echo "</div>\n";
  161.  
  162. ?>